
#include "nane/ScriptSystem/ScriptModuleImpl_.h"
#include "nane/ScriptSystem/ScriptObjectImpl_.h"

#include "nane/core/assert.h"

namespace nane
{
    ////////////////////////////////////////////////////////////////////////////////////////////////
    ScriptModule::Implementation::Implementation( ScriptSystem::Implementation* _creator, IScriptModule* _interface, const char* _name )
        : SubSystemProductImpl<ScriptModule::Implementation, ScriptSystem::Implementation, IScriptModule*>( _creator, _interface )
        , name( _name )
    {
        NANE_ASSERT( interface != NULL, "IScriptModule interface must be valid" );
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    ScriptModule::Implementation::~Implementation()
    {
        
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    void ScriptModule::Implementation::Release( ScriptObject::Implementation* _scriptObjectImpl )
    {
        NANE_ASSERT( _scriptObjectImpl != NULL && this == _scriptObjectImpl->creator, "ScriptObject must be valid" );
        IScriptObject* scriptObjectInterface = _scriptObjectImpl->interface;
        delete _scriptObjectImpl;
        interface->ReleaseObject(scriptObjectInterface);
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
}   // namespace nane
